package calculator;

public class OperationExecutor {

	private Expression expression;

	public OperationExecutor(Expression e) {
		this.expression = e;
	}

	public int calculate(int index) {
		String op = expression.getOperator(index);
		if ("+".equals(op)) {
			return new IntegerCalculator().add(expression.getNumber(index - 1)
					, expression.getNumber(index + 1));
		}
		return 5;
	}

}
